/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.front.service;

import java.util.List;

import org.apache.commons.lang3.StringEscapeUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.front.entity.News;
import com.thinkgem.jeesite.modules.front.dao.NewsDao;

/**
 * 新闻资讯管理Service
 * @author 朱俊吉祥
 * @version 2017-11-27
 */
@Service
@Transactional(readOnly = true)
public class NewsService extends CrudService<NewsDao, News> {

	public News get(String id) {
		return super.get(id);
	}
	
	public List<News> findList(News news) {
		return super.findList(news);
	}
	
	public Page<News> findPage(Page<News> page, News news) {
		return super.findPage(page, news);
	}
	
	@Transactional(readOnly = false)
	public void save(News news) {
		//将ckditor文本编辑框内容转换为DOM
		news.setContent(StringEscapeUtils.unescapeHtml4(news.getContent()));
		super.save(news);
	}
	
	@Transactional(readOnly = false)
	public void delete(News news) {
		super.delete(news);
	}

	public List<News> getHotNewsList(Integer start, Integer end) {
		
		return dao.getHotNewsList(start, end);
	}
	
}